package org.cuckoos.android;

import java.net.DatagramSocket;

import org.cuckoos.android.command.AbstractCommand;

import android.app.Activity;
/**
 * 
 * @author bugu
 *
 */
public abstract class SocketService {
	private static SocketService _instance;

	/**
	 * 启动socket服务
	 * @param activity
	 */
	public abstract void start(Activity activity);
	/**
	 * 返回socket
	 * @return
	 */
	public abstract DatagramSocket getSocket();
	
	
	public abstract void addHandler(AbstractCommand handler);
	
	public abstract void removeHandler(AbstractCommand handler);
	
	public abstract void stop();
	
	public static SocketService getDefault(){
		if(_instance == null ){
			_instance = new DefaultSocketService();
		}
		return _instance;
	}
}
